package daily;

import lombok.extern.slf4j.Slf4j;

/**
 * @Date 2022/3/2
 * @Created by Jonathan
 */
@Slf4j
public class PowerOfTwo {
    public static void main(String[] args) {
        isPowerOfTwo(32);
        isPowerOfTwo(64);
        isPowerOfTwo(128);
        isPowerOfTwo(31);
    }

    private static void isPowerOfTwo(int scale) {
        if ((scale & (scale - 1)) == 0) {
            log.info("{}--->是2的整数次幂。", scale);
        } else {
            log.info("{}--->不是2的整数次幂。", scale);
        }
    }

}
